<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@page import="java.util.List"%>
<%@page import="java.util.List"%>
<%@page import="Entity.Penelitian"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<!DOCTYPE html>
<%@include file="../header.jsp"%>
<script>
    function validateForm()
    {						
        if(document.frm.tahunMulai.value=="" && document.frm.tahunAkhir.value!="")
        {                                                
            document.getElementById("periode_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Periode awal belum terisi.</div>";
            return false;
        } else if(document.frm.tahunMulai.value!="" && document.frm.tahunAkhir.value=="")
        {                                                
            document.getElementById("periode_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Periode akhir belum terisi.</div>";
            return false;
        } else if(document.frm.tahunMulai.value > document.frm.tahunAkhir.value)
        {
            document.getElementById("periode_error").innerHTML="<div class='error-left'></div><div class='error-inner'>Periode awal harus lebih kecil dari periode akhir.</div>";
            return false;
        }
    }
</script>
<!-- start content-outer ........................................................................................................................START -->
<div id="content-outer">
    <!-- start content -->
    <div id="content">

        <!--  start page-heading -->
        <div id="page-heading">
            <h1>Rekapitulasi Mahasiswa yang Terlibat Dalam ${jenisPPM}</h1>
        </div>
        <!-- end page-heading -->

        <!-- start search -->
        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tr>
                <th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                <th class="topleft"></th>
                <td id="tbl-border-top">&nbsp;</td>
                <th class="topright"></th>
                <th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
            </tr>
            <tr>
                <td id="tbl-border-left"></td>
                <td>
                    <!--  start content-table-inner ...................................................................... START -->
                    <div id="content-table-inner">

                        <!--  start table-content  -->

                        <!-- start pencarian -->
                        <div id="table-search">
                            <form id="mainform" action="
                                  <c:if test="${(jenisPPM == 'Penelitian')}">
                                      rekapMahasiswaPeneliti?status=submit
                                  </c:if>
                                  <c:if test="${(jenisPPM == 'Pengabdian Masyarakat')}">
                                      rekapMahasiswaPengmas?status=submit
                                  </c:if>                        
                                  " method="POST" onsubmit="return validateForm()" name="frm">
                                <table border="0" width="100%" cellpadding="0" cellspacing="0" id="id-form">
                                    <tr>
                                        <th width="300" align="left" valign="middle">Rentang Tahun</th>
                                        <td width="15" align="center" valign="middle">:</td>
                                        <td>
                                                <select id="tahunMulai" name="tahunMulai" class="styledselect-year">
                                                <option value=""                                                        
                                                        <%
                                                            String periodeMulai = (String) request.getAttribute("tahunMulai");
                                                            if (periodeMulai.equals("")) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        >Seluruh Periode</option>
                                                <%
                                                    Calendar c = Calendar.getInstance();
                                                    c.setTime(new Date());
                                                    //String d = + "-"+c.MONTH+"-"+c.DATE;
                                                    int tahun = c.get(Calendar.YEAR);
                                                    for (int i = 0; i < 10; i++) {
                                                %>
                                                <option value="<% out.print(tahun);%>"                                                         
                                                        <% if (periodeMulai.equals("" + tahun)) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        ><% out.print(tahun);%></option>
                                                <%
                                                        tahun--;
                                                    }%>

                                            </select> &nbsp;s.d &nbsp; <select  id="tahunAkhir" name="tahunAkhir" class="styledselect-year">
                                                <option value=""                                                        
                                                        <%
                                                            String periodeSelesai = (String) request.getAttribute("tahunSelesai");
                                                            if (periodeSelesai.equals("")) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        >Seluruh Periode</option>
                                                <%
                                                    Calendar d = Calendar.getInstance();
                                                    d.setTime(new Date());
                                                    //String d = + "-"+c.MONTH+"-"+c.DATE;
                                                    int periodeAkhir = d.get(Calendar.YEAR);
                                                    for (int i = 0; i < 10; i++) {
                                                %>
                                                <option value="<% out.print(periodeAkhir);%>"                                                         
                                                        <%
                                                            if (periodeSelesai.equals("" + periodeAkhir)) {%>
                                                        selected="selected"
                                                        <% }%>
                                                        ><% out.print(periodeAkhir);%></option>
                                                <%
                                                        periodeAkhir--;
                                                    }%>
                                            </select></td>
                                        <td id="periode_error" valign="middle"></td>
                                    </tr>
                                    <tr>
                                        <th valign="top">Tampilkan Dalam Bentuk </th>
                                        <td align="center" valign="middle">:</td>
                                        <td><select name="jenisCetak" class="styledselect_form_1">
                                                <option value="1">Tampilkan di Halaman Web</option>
                                                <option value="2">Cetak ke Excel</option>
                                            </select></td>
                                        <td valign="middle"></td>
                                    </tr>
                                    <tr>
                                        <th>&nbsp;</th>
                                        <td valign="top">&nbsp;</td>
                                        <td valign="top"><input value="" class="form-tampilkan" type="submit" />
                                    </tr>
                                </table>
                            </form>
                        </div>
                        <!-- end pencarian -->
                        <div id="table-content">
                            <!--  start product-table ..................................................................................... -->
                            <table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
                                <tr>
                                    <th class="table-header-repeat line-left"><a href="">NO. </a></th>
                                    <th class="table-header-repeat line-left"><a href="">Nama Mahasiswa</a></th>
                                    <th class="table-header-repeat line-left"><a href="">NRP Mahasiswa</a></th>
                                    <th class="table-header-repeat line-left"><a href="">
                                            <c:if test="${(jenisPPM == 'Penelitian')}">
                                                Judul Penelitian
                                            </c:if>
                                            <c:if test="${(jenisPPM == 'Pengabdian Masyarakat')}">
                                                Judul Pengabdian Masyarakat
                                            </c:if>
                                        </a></th>
                                    <th class="table-header-repeat line-left"><a href="">Tanggal Pelaksanaan</a></th>
                                    <th class="table-header-repeat line-left"><a href="">
                                            <c:if test="${(jenisPPM == 'Penelitian')}">
                                                Judul Tugas Akhir
                                            </c:if>
                                            <c:if test="${(jenisPPM == 'Pengabdian Masyarakat')}">
                                                Keterlibatan Mahasiswa
                                            </c:if>
                                        </a></th>
                                </tr>
                                <% int i = 1;%>
                                <c:if test="${empty listMhsPeneliti}" >
                                        <tr>
                                            <td colspan="8" align="center" bordercolor="#FF0000" bgcolor="#FF0000"><strong>Data Tidak Ada</strong>
                                            </td>
                                        </tr>   
                                    </c:if>
                                <c:forEach items="${listMhsPeneliti}" var="listMhsPeneliti" >
                                    <tr>
                                        <td><%out.print(i + ". ");%><%i++;%> </td>
                                        <td>${listMhsPeneliti.namaUser}</td>
                                        <td>${listMhsPeneliti.nrpUser}</td>
                                        <td>${listMhsPeneliti.judulPpm}</td>
                                        <td>
                                                <fmt:parseDate value="${listMhsPeneliti.tanggalMulai}" var="parsedTanggalMulai" pattern="yyyy-MM-dd" />
                                                <fmt:formatDate type="date" dateStyle="long" value="${parsedTanggalMulai}"/> 
                                                s.d 
                                                <fmt:parseDate value="${listMhsPeneliti.tanggalSelesai}" var="parsedTanggalSelesai" pattern="yyyy-MM-dd" />
                                                <fmt:formatDate type="date" dateStyle="long" value="${parsedTanggalSelesai}"/>
                                        </td>
                                        <td>
                                            <c:if test="${(jenisPPM == 'Penelitian')}">
                                                ${listMhsPeneliti.judulTugasAkhir} 
                                            </c:if>
                                            <c:if test="${(jenisPPM == 'Pengabdian Masyarakat')}">
                                                ${listMhsPeneliti.peran} 
                                            </c:if>  
                                        </td>
                                    </tr>
                                </c:forEach>
                            </table>
                            <!--  end product-table................................... --> 
                        </div>
                        <!--  end content-table  -->

                        <!--  start actions-box ............................................... --><!-- end actions-box........... -->

                        <!--  start paging..................................................... -->
                        <table border="0" cellpadding="0" cellspacing="0" id="paging-table">
                            <tr>
                                <td>
                                    <a href="" class="page-far-left"></a>
                                    <a href="" class="page-left"></a>
                                    <div id="page-info">Page <strong>1</strong> / 15</div>
                                    <a href="" class="page-right"></a>
                                    <a href="" class="page-far-right"></a>
                                </td>
                                <td>
                                    <select  class="styledselect_pages">
                                        <option value="">Number of rows</option>
                                        <option value="">1</option>
                                        <option value="">2</option>
                                        <option value="">3</option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                        <!--  end paging................ -->

                        <div class="clear"></div>

                    </div>
                    <!--  end content-table-inner ............................................END  -->
                </td>
                <td id="tbl-border-right"></td>
            </tr>
            <tr>
                <th class="sized bottomleft"></th>
                <td id="tbl-border-bottom">&nbsp;</td>
                <th class="sized bottomright"></th>
            </tr>
        </table>
        <div class="clear">&nbsp;</div>

    </div>
    <!--  end content -->
    <div class="clear">&nbsp;</div>
</div>
<!--  end content-outer........................................................END -->

<div class="clear">&nbsp;</div>
<%@include file="../footer.jsp"%>